package com.juyu.miliao.api.service;

import com.juyu.miliao.api.service.cache.ConfigWxPayCacheService;
import com.juyu.miliao.common.domain.ConfigWxPay;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class ConfigWxPayService {
    @Resource
    private ConfigWxPayCacheService configWxPayCacheService;


    public ConfigWxPay getConfigWxPay(String appPackageId,int phoneSystem){
        Map<String,ConfigWxPay> configWxPayMap = configWxPayCacheService.getConfigWxPayMap();
        String key = appPackageId+"_"+phoneSystem;
        return configWxPayMap.get(key);
    }

    public ConfigWxPay getConfigWxPayByAppPackageIdAndPhoneSystemAndType(String appPackageId,int phoneSystem,
                                                                         int type){
        Map<String,ConfigWxPay> configWxPayMap = configWxPayCacheService
                .getConfigWxPayMapByAppPackageIdAndPhoneSystemAndType();

        String key = appPackageId+"_"+phoneSystem+'_'+type;
        return configWxPayMap.get(key);
    }

}
